package com.fnst.caesar.servlet;

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

import com.fnst.caesar.bean.*;
import com.fnst.caesar.util.*;

import org.apache.ibatis.session.*;

/**
 * Servlet implementation class ExportExcel_Servlet
 */
public class ExportExcel_Servlet extends HttpServlet
{
	private static final long serialVersionUID = 1L;
	
	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public ExportExcel_Servlet()
	{
		super();
		// TODO Auto-generated constructor stub
	}
	
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException
	{
		// TODO Auto-generated method stub
		doPost(request, response);
	}
	
	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException
	{
		// TODO Auto-generated method stub
		SqlSessionFactory ssf = SqlFactoryUtil.getSqlSessionFactory(request);
		SqlSession listClass = ssf.openSession();
		List queryResult = listClass.selectList("com.fnst.caesar.mapper.selectClassTeachByTeachState", "finished");
		request.setAttribute("queryResult", queryResult);
		listClass.close();
		
		String open_id = request.getParameter("open_id");
		String type = request.getParameter("exportType");
		if(open_id == null || type == null)
		{
			request.getRequestDispatcher("/WEB-INF/WEB/Export_Excel.jsp").forward(request, response);
		}
		else
		{
			int flag = Integer.parseInt(type);
			int id = Integer.parseInt(open_id);
			if(flag == 1 || flag == 3)
			{
				
			}
			if(flag == 2 || flag == 3)
			{
				
			}
		}
	}
	
}
